{{extend '../layout.html'}}
{{block 'body'}}
<div class="container">
  <form action="/publish/add" method="post" id="form1">
    <div class="form-group">
      <label for="userName">标题</label>
      <input type="text" class="form-control" id="title" name="title">
    </div>
    <div class="form-group">
      <label for="password">内容</label>
      <textarea class="form-control" name="content" id="content"></textarea>
    </div>
    <button id="sub" type="button" class="btn btn-primary">Submit</button>
    <button id="cancel" type="button" class="btn btn-default">Cancel</button>
  </form>
</div>
<script type="text/javascript">
// swal('1','2','error');
$('#cancel').click(function(){
    location.href = "/home";
});
$('#sub').click(function(){
    if(!$('#title').val()){
      swal('','标题不能为空','error');
      return ;
    }
    // document.getElementById('form1').submit();
    $('#form1').submit();
});
</script>
{{/block}}